package com.fsy.spring.observer;

import java.util.*;

/**
 * Created by shuangyu.feng on 2017/7/27.
 */
public abstract class AbstractOberser implements IOberserWork{
	private Set<IObserver> observerSet = new HashSet<IObserver>();

	public void add(IObserver iObserver) {
		observerSet.add(iObserver);
	}

	public void sub(IObserver iObserver) {
		observerSet.remove(iObserver);
	}

	public void notifyAllObserver() {
		for(IObserver iObserver : observerSet){
			iObserver.sendMessage();
		}
	}

	public void doSelfWork() {}
}
